<style type="text/css">
div.box{width:190px;
   	height: 210px;
    overflow:auto;padding: 4px;
    border:1px solid #EEE;border-right:0 solid;
    background:url(gradient.png) repeat-x fixed top left}

div.box p{margin-top:0}
</style>
<div class="box">
<table>

<tr><td><input type="checkbox" id="allCheck" value="ALL" onclick="de_selectall()"/></td><td>Select All</td></tr>

<?php
$limit = 'LIMIT 0, 10';
if ( isset ($_GET['all']) )
	if ($_GET['all'] == 'yes')
		$limit = '';
	else 
		$limit = 'LIMIT 0, 10';

$db = new DBManager ( 'localhost',  'root',  '',  'iumus' );
$query="SELECT Username FROM utente WHERE Username<> 'admin' ".$limit;
$result = $db->executeQuery ($query);

while ( $row = mysql_fetch_array($result) ){
	echo '<tr><td><input type="checkbox" name="reciver[]" value="'.$row['Username'].'"/></td><td>'.$row['Username'].'</td></tr>';
}
if ( mysql_num_rows($result) >= 10  &&  !isset ($_GET['all']))
	echo '<tr><td colspan="2"><a href="writeMsg.php?all=yes">show all user</td></tr>'

?>


</table>
</div>
<script type="text/javascript">
	function de_selectall(){
		if ( document.getElementById("allCheck").checked == true ){
		
			for (var x = 0; x < (document.getElementsByName('reciver[]').length); x++)
			  {
					document.getElementsByName('reciver[]')[x].checked = true;
			  }
		}
		else{
			for (var x = 0; x < (document.getElementsByName('reciver[]').length); x++)
			  {
					document.getElementsByName('reciver[]')[x].checked = false;
			  }
		}
	}
</script>